package book_management.operation.impl;

import book_management.book.Book;
import book_management.book.BookList;
import book_management.operation.IOperation;

public class BorrowOperation implements IOperation {
    //借书
    @Override
    public void work(BookList bookList) {
        System.out.println("你现在进行的是借书操作");
        System.out.println("请输入你要借的书名");
        String bookName = scanner.next();
        if (bookList.contains(bookName)) {
            Book book = bookList.find(bookName);
            if (book.isBorrowed()==false) {
                bookList.borrow(book);
                System.out.println("借书成功！");
            }else {
                System.out.println("该书已借出");
            }
        } else {
            System.out.println("没有此书");
        }
    }
}
